﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomerLibrary.aspx.cs"
    Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Customer Library</title>
    <%--<script type="text/javascript" src="assets/js/jquery.js"></script>

    <script type='text/javascript' src="assets/js/jquery.min.js"></script>--%>
    <script src="assets/js/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="assets/jquery/jquery-ui.min.js" type="text/javascript"></script>
    <script src="assets/jquery/jquery.dialog.extra.js" type="text/javascript"></script>
    <script type='text/javascript' src="assets/js/jquery-tab.min.js"></script>
    <script type='text/javascript' src="assets/js/jquery.bgiframe.min.js"></script>
    <script type='text/javascript' src="assets/js/jquery.ajaxQueue.js"></script>
    <script type='text/javascript' src="assets/js/thickbox-compressed.js"></script>
    <script type='text/javascript' src="assets/js/jquery.autocomplete.js"></script>
    <link rel="stylesheet" type="text/css" href="assets/css/datepicker.css" />
    <script type='text/javascript' src="assets/js/jquery.ui.datepicker.js"></script>
    <script type='text/javascript' src="Assets/js/jquery-custom-1.0.0.js?v=0611"></script>
    <script type='text/javascript' src="Assets/js/zoom.js"></script>
    <script type='text/javascript' src="assets/js/common.js"></script>
    <script type='text/javascript' src="Assets/js/encoder.js"></script>
    <script type='text/javascript' src="assets/js/DomesticPOR.js"></script>
    <script type='text/javascript' src="Assets/js/customerstore.js"></script>
    <link href="assets/jquery/jquery-ui.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="assets/css/jquery.autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="assets/css/thickbox.css" />
    <link rel="stylesheet" href="assets/css/reset.css" type="text/css" />
    <link rel="stylesheet" href="assets/css/styleexpress.css" type="text/css" />
    <link rel="stylesheet" href="assets/css/invalid.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="Assets/css/EditTableCell.css" type="text/css" />
    <link rel="stylesheet" href="Assets/css/zoom.css" type="text/css" />
    <script type="text/javascript">
        var nPermissions = '<%=nPermissions %>';
        function doImportCustomer() {
            var url = 'ImportCustomerLibrary.aspx';
            window.open(url, 'ImportCustomerLibrary', 'width=600,height=300,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
        }
        function doCheckBulkDelete() {
            var listCust = $("#txtListCustomerStoreDateID").val();
            if (listCust != "") {
                if (confirm('Bạn có thực sự muốn xóa?')) {
                    var vnpage = getUrlVars()['page_number'];
                    if (vnpage)
                        window.location.href = "CustomerLibrary.aspx?action=bulkdelete&page_number=" + vnpage + "&listCust=" + listCust;
                    else
                        window.location.href = "CustomerLibrary.aspx?action=bulkdelete" + "&listCust=" + listCust;
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                alert("Bạn phải chọn ít nhất một khách hàng!");
                return false;
            }
            return false;
        }
        function doSelectCustomer(custid) {
            var checked = document.getElementById("chbCustomer_" + custid).checked;
            var currentList = window.document.forms.frmCustomers.txtListCustomerID.value;
            if (currentList == "")
                currentList = ";";
            if (checked) {
                document.getElementById("txtListCustomerID").value = currentList + custid + ";";

            } else {
                document.getElementById("txtListCustomerID").value = currentList.replace(";" + custid + ";", ";");
            }
        }
        $(function () {
            $("#txtFrom").datepicker({ dateFormat: "dd-mm-yy" });
            $("#txtTo").datepicker({ dateFormat: "dd-mm-yy" });

            $("#selectAll").click(function () {
                var rschecked = this.checked;
                $('.checkrate').each(function (index, item) {
                    item.checked = rschecked;
                    AddSelectedToList(item);
                });
            });
            $(".checkrate").click(function () {
                AddSelectedToList(this);
            });
        });
        function AddSelectedToList(obj) {
            var selected = new Array();
            selected = $("#txtListCustomerStoreDateID").val().split(',');
            var newFilter = obj.value;
            var found = jQuery.inArray(newFilter, selected);
            if (found >= 0) {
                // Element was found, remove it.
                if (!obj.checked)
                    selected.splice(found, 1);
            } else {
                // Element was not found, add it.
                if (obj.checked)
                    selected.push(newFilter);
            }
            $("#txtListCustomerStoreDateID").val(selected)
        }    
    </script>
    <style type="text/css">
        .thheader
        {
            font-weight: bold;
            vertical-align: middle;
            text-align: center;
            font-size: 11px;
            border: 1px solid #ccc !important;
            line-height: 12px !important;
        }
        .tdboder
        {
            border: none !important;
        }
        .tdboder p
        {
            padding: 1px !important;
            width: 40px;
            border: 1px solid #ccc !important;
            border-bottom: 1px solid #ccc !important;
        }
        .rdCustStyle
        {
            margin-left: 20px;
        }
        .rdCustStyle input
        {
            cursor: pointer;
        }
        .rdCustStyle table
        {
            border-collapse: separate !important; ;}</style>
</head>
<body>
    <div id="body-wrapper">
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <div id="main-content1">
            <h2>
                CUSTOMER LIBRARY
            </h2>
            <div class="clear">
            </div>
            <div class="content-box" zoomable="true">
                <form id="frmCustomers" runat="server">
                <div class="content-box-header">
                    <h3 style="cursor: s-resize;">
                    </h3>
                    <div style="padding-top: 8px;">
                        <asp:TextBox ID="keyword" Text="" runat="server" placeholder="INPUT KEYWORDS" Style="padding: 3px;"></asp:TextBox>
                        &nbsp;
                        <asp:DropDownList ID="ddFindType" runat="server">
                            <asp:ListItem Text="FIND BY" Value=""></asp:ListItem>
                            <asp:ListItem Text="MKH" Value="CODE"></asp:ListItem>
                            <asp:ListItem Text="CUST" Value="NAME"></asp:ListItem>
                            <asp:ListItem Text="PTNER" Value="PTNER"></asp:ListItem>
                            <asp:ListItem Text="BL" Value="BLNo"></asp:ListItem>
                            <asp:ListItem Text="VNWRHSE" Value="VNWRHSE"></asp:ListItem>
                            <asp:ListItem Text="POLCODE" Value="POLCODE"></asp:ListItem>
                            <asp:ListItem Text="POLNAME" Value="POLNAME"></asp:ListItem>
                            <asp:ListItem Text="PODCODE" Value="PODCODE"></asp:ListItem>
                            <asp:ListItem Text="PODNAME" Value="PODNAME"></asp:ListItem>
                            <asp:ListItem Text="MADEIN" Value="MADEIN"></asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;
                        <%-- <asp:DropDownList ID="ddTYPE" runat="server" Width="100px" AutoPostBack="True" OnSelectedIndexChanged="btnSearch_Click">
                        </asp:DropDownList>--%>
                        <asp:TextBox ID="txtTYPE" runat="server" placeholder=" TYPE " Style="padding: 3px;
                            width: 75px;"></asp:TextBox>
                        &nbsp;
                        <asp:DropDownList ID="ddProvince" runat="server" Width="100px" AutoPostBack="True"
                            OnSelectedIndexChanged="btnSearch_Click">
                        </asp:DropDownList>
                        &nbsp;
                        <%--<asp:DropDownList ID="ddCOUNTRY" runat="server" Width="100px" AutoPostBack="True"
                            OnSelectedIndexChanged="btnSearch_Click">
                        </asp:DropDownList>--%>
                        <asp:TextBox ID="txtCOUNTRY" runat="server" placeholder=" PTNER NA " Style="padding: 3px;
                            width: 75px;"></asp:TextBox>
                        &nbsp;
                        <asp:TextBox ID="txtFrom" Style="padding: 3px;" CssClass="calendar-icon" runat="server"
                            value="FROM" onclick="if(this.value=='FROM'){this.value=''; this.style.color='#000'}"
                            onblur="if(this.value==''){this.value='FROM'; this.style.color='#555'}" Width="80px"></asp:TextBox>
                        &nbsp;
                        <asp:TextBox ID="txtTo" Style="padding: 3px;" CssClass="calendar-icon" runat="server"
                            value="TO" Width="80px" onclick="if(this.value=='TO'){this.value=''; this.style.color='#000'}"
                            onblur="if(this.value==''){this.value='TO'; this.style.color='#555'}"></asp:TextBox>
                        &nbsp;
                        <asp:DropDownList ID="ddDlvry" runat="server" AutoPostBack="True" OnSelectedIndexChanged="btnSearch_Click">
                            <asp:ListItem Value="" Text="DLVRY"></asp:ListItem>
                            <asp:ListItem Value="C_D" Text="C&D"></asp:ListItem>
                            <asp:ListItem Value="F_E" Text="F&E"></asp:ListItem>
                            <asp:ListItem Value="C_F" Text="C&F"></asp:ListItem>
                            <asp:ListItem Value="CNF" Text="CNF"></asp:ListItem>
                            <asp:ListItem Value="CANDF" Text="CANDF"></asp:ListItem>
                            <asp:ListItem Value="CFR" Text="CFR"></asp:ListItem>
                            <asp:ListItem Value="CIF" Text="CIF"></asp:ListItem>
                            <asp:ListItem Value="CPT" Text="CPT"></asp:ListItem>
                            <asp:ListItem Value="CIP" Text="CIP"></asp:ListItem>
                            <asp:ListItem Value="DDP" Text="DDP"></asp:ListItem>
                            <asp:ListItem Value="DDU" Text="DDU"></asp:ListItem>
                            <asp:ListItem Value="DAP" Text="DAP"></asp:ListItem>
                            <asp:ListItem Value="DAT" Text="DAT"></asp:ListItem>
                            <asp:ListItem Value="DES" Text="DES"></asp:ListItem>
                            <asp:ListItem Value="DEQ" Text="DEQ"></asp:ListItem>
                            <asp:ListItem Value="FOB" Text="FOB"></asp:ListItem>
                            <asp:ListItem Value="FCA" Text="FCA"></asp:ListItem>
                            <asp:ListItem Value="FAS" Text="FAS"></asp:ListItem>
                            <asp:ListItem Value="EXW" Text="EXW"></asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;
                        <asp:DropDownList ID="ddGOODSCODE" runat="server" Width="100px" AutoPostBack="True"
                            OnSelectedIndexChanged="btnSearch_Click">
                        </asp:DropDownList>
                        &nbsp;
                        <asp:DropDownList ID="ddGOODSNAME" runat="server" Width="100px" AutoPostBack="True"
                            OnSelectedIndexChanged="btnSearch_Click">
                        </asp:DropDownList>
                        &nbsp;
                        <%--<asp:DropDownList ID="ddROUTEBY" runat="server" Width="100px" AutoPostBack="True"
                            OnSelectedIndexChanged="btnSearch_Click">
                        </asp:DropDownList>--%>
                        <asp:TextBox ID="txtROUTEBY" runat="server" placeholder=" BY " Style="padding: 3px;
                            width: 50px;"></asp:TextBox>
                        &nbsp;
                        <asp:Button ID="btnSearch" runat="server" Text="&nbsp;Seach&nbsp;" CssClass="button"
                            OnClick="btnSearch_Click" />
                    </div>
                </div>
                <div style="margin-bottom: 10px; float: right; padding-right: 20px; padding-top: 5px;
                    font-size: 16px; font-weight: bold;">
                    <%if (nPermissions > 3)
                      { %>
                    <a class="button" href="#" onclick="return doCheckBulkDelete();">Delete</a> &nbsp;
                    &nbsp; &nbsp; <a class="button" href="#" onclick="doImportCustomer();">Import Data
                    </a>
                    <%} %>
                </div>
                <div class="clear">
                </div>
                <fieldset>
                    <div autofit="true" style="">
                        <asp:Repeater ID="rptData" runat="server">
                            <ItemTemplate>
                                <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'"
                                    cusid='<%#Eval("ID") %>'>
                                    <td align="center">
                                        <input type="checkbox" class="checkrate" name="cbCheckCusStoreDate" value='<%#Eval("ID") %>' />
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "CREATEDATE")%>
                                    </td>
                                    <td class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "CODE")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "NAME")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "ProvinceName")%>
                                    </td>
                                    <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                      { %>
                                    <td style="font-size: 10px;" class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "PTNER")%>
                                    </td>
                                    <%} %>
                                    <td class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "COUNTRYCODE")%>
                                    </td>
                                    <td style="font-size: 10px;" class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "TYPE")%>
                                    </td>
                                    <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                      { %>
                                    <td class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "BLNo")%>
                                    </td>
                                    <%} %>
                                    <td style="font-size: 10px;" class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "VNWRHSE")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "PODCountryName")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "PODNAME")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "POLCountryName")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "POLNAME")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "DLVRY")%>
                                    </td>
                                    <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                      { %>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "CURRENCY")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "REVENUE")%>
                                    </td>
                                    <%} %>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "GOODSCODE")%>
                                    </td>
                                    <td style="font-size: 10px;" class="wrapword">
                                        <%# DataBinder.Eval(Container.DataItem, "GOODSNAME")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "VOLUME")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "UNIT")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "MADEIN")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "ROUTEBY")%>
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <HeaderTemplate>
                                <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist">
                                    <thead>
                                        <tr>
                                            <th align="center" class="thheader" width="50px" rowspan="2">
                                                <input type="checkbox" id="selectAll" />
                                            </th>
                                            <th align="center" width="50px" rowspan="2">
                                                DATE
                                            </th>
                                            <th align="center" width="50px" rowspan="2">
                                                MKH
                                            </th>
                                            <th align="center" width="150px" rowspan="2">
                                                CUST
                                            </th>
                                            <th align="center" width="50px" rowspan="2">
                                                ADD
                                            </th>
                                            <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                              { %>
                                            <th align="center" width="100px" colspan="2">
                                                PTNER
                                            </th>
                                            <%}else{ %>
                                            <th align="center" width="50px" rowspan="2">
                                                PTNER NA
                                            </th>
                                            <%} %>
                                            <th align="center" width="100px" rowspan="2">
                                                TYPE
                                            </th>
                                            <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                              { %>
                                            <th align="center" width="50px" rowspan="2">
                                                B/L
                                            </th>
                                            <%} %>
                                            <th align="center" width="75px" rowspan="2">
                                                VNWRHSE
                                            </th>
                                            <th align="center" width="100px" colspan="2">
                                                POD
                                            </th>
                                            <th align="center" width="50px" colspan="2">
                                                POL
                                            </th>
                                            <th align="center" width="" rowspan="2">
                                                DLV
                                            </th>
                                            <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                              { %>
                                            <th align="center" width="" rowspan="2">
                                                CUR
                                            </th>
                                            <th align="center" width="" rowspan="2">
                                                VLE
                                            </th>
                                            <%} %>
                                            <th align="center" width="" rowspan="2">
                                                CODE
                                            </th>
                                            <th align="center" width="" rowspan="2" width="100px">
                                                COMMD
                                            </th>
                                            <th align="center" width="" rowspan="2">
                                                VOL
                                            </th>
                                            <th align="center" width="" rowspan="2">
                                                UNT
                                            </th>
                                            <th align="center" width="" rowspan="2">
                                                NXX
                                            </th>
                                            <th align="center" width="" rowspan="2">
                                                BY
                                            </th>
                                        </tr>
                                        <tr>
                                            <%if (nPermissionPrivateFields > 0 || nPermissions > 7)
                                              { %>
                                            <th align="center" width="150px">
                                                PTNER
                                            </th>
                                            <th align="center" width="50px">
                                                NA
                                            </th>
                                            <%} %>
                                            <th align="center" width="50px">
                                                NA
                                            </th>
                                            <th align="center" width="50px">
                                                POD
                                            </th>
                                            <th align="center" width="50px">
                                                NA
                                            </th>
                                            <th align="center" width="50px">
                                                POL
                                            </th>
                                        </tr>
                                    </thead>
                            </HeaderTemplate>
                            <FooterTemplate>
                                </TABLE>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                </fieldset>
                <div class="clear">
                </div>
                <div id="footer">
                    <%=strPager%>
                </div>
                <input type="hidden" id="txtListCustomerStoreDateID" name="txtListCustomerStoreDateID"
                    runat="server" value="" />
                </form>
            </div>
        </div>
    </div>
</body>
</html>
